<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .box {
            width: 1000px;
            height: 1000px;
            margin: 0 auto;
        }

        ul {
            list-style: none;
            width: 300px;
            height: 500px;
            border-color: burlywood;
            border: solid;
            color: gray;
            display: none;
        }

        .text {
            width: 290px;
            height: 25px;
            border: solid;
            padding-left: 10px;
            /* outline: burlywood; */
            /* border-bottom: none; */

        }

        li {
            margin-left: 10px;
            margin-top: 10px;
        }
    </style>
</head>

<body>
    <div class="box">
        <!-- <div class="box2"></div>
        <div class="box3"></div> -->
        <input class="text" type="text" placeholder="小米笔记本">
        <ul>
            <li>全部商品</li>
            <li>小米11</li>
            <li>小米10s</li>
            <li>小米笔记本</li>
            <li>小米手机</li>
            <li>黑鲨4</li>
            <li>空调</li>
        </ul>
    </div>
    <script>
        const ul = document.querySelector('ul')
        const text = document.querySelector('.text')
        text.addEventListener('focus', function () {
            ul.style.display = 'block'
        })
        text.addEventListener('blur', function () {
            ul.style.display = 'none'
        })
    </script>
</body>

</html>